guide_bins
Creates a binned version of guide_legend and then convert them with ggplotly.
p <- ggplot(mtcars) + geom_point(aes(disp, mpg, size = hp)) + scale_size_binned()
plotly::ggplotly(p)
p <- ggplot(mtcars) + geom_point(aes(disp, mpg, size = hp)) + scale_size_binned() p <- p + guides(size = guide_bins(axis = FALSE))
plotly::ggplotly(p)
p <- ggplot(mtcars) + geom_point(aes(disp, mpg, size = hp)) + scale_size_binned() p <- p + guides(size = guide_bins(show.limits = TRUE))
plotly::ggplotly(p)
p <- ggplot(mtcars) + geom_point(aes(disp, mpg, size = hp)) + scale_size_binned() p <- p + guides(size = guide_bins( axis.arrow = arrow(length = unit(1.5, 'mm'), ends = 'both') ))
plotly::ggplotly(p)
p <- ggplot(mtcars) + geom_point(aes(disp, mpg, size = hp, colour = hp)) + scale_size_binned() + scale_colour_binned(guide = "bins")
plotly::ggplotly(p)